//
//  CALayer+AWTheme.m
//  changeShin
//
//  Created by Alan Wang on 2019/3/26.
//  Copyright © 2019 Alan Wang. All rights reserved.
//

#import "CALayer+AWTheme.h"
#import "NSObject+AWTheme.h"

@implementation CALayer (AWTheme)
-(void)AWTheme_BackgroundColorForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        UIColor * color = [[AWThemeManager shareInstance] colorForKey:key];
        if(color){
            self.backgroundColor = color.CGColor;
        }
    } forKey:@"backgroundColor"];
}
-(void)AWTheme_BorderColorForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        UIColor * color = [[AWThemeManager shareInstance] colorForKey:key];
        if(color){
            self.borderColor = color.CGColor;
        }
    } forKey:@"borderColor"];
}
-(void)AWTheme_ShadowColorForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        UIColor * color = [[AWThemeManager shareInstance] colorForKey:key];
        if(color){
            self.shadowColor = color.CGColor;
        }
    } forKey:@"shadowColor"];
}
-(void)AWTheme_BorderWidthForKey:(NSString*)key{
    AWweakify(self)
    [self saveBlok:^{
        AWstrongify(self)
        self.borderWidth = [[AWThemeManager shareInstance] floatForKey:key];
    } forKey:@"borderWidth"];
}
@end
